package com.devilvan.betrice.aiqicha.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.devilvan.betrice.common.BasePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * @author Evad.Wu
 * @Description 爱企查-对外投资信息 映射
 * @date 2022-09-23
 */
@Setter
@Getter
@ToString(exclude = "aiqichaHeaderPo")
@NoArgsConstructor
@Accessors(chain = true)
@TableName(value = "AIQICHA_INVEST_RECORD")

@Entity
@Table(name = "AIQICHA_INVEST_RECORD")
@DynamicInsert
@EntityListeners(AuditingEntityListener.class)
@Schema(description = "爱企查-对外投资信息 映射")
public class AiqichaInvestRecordPo extends BasePo implements Serializable {
    @Serial
    private static final long serialVersionUID = -4167144948439658297L;
    @Schema(description = "企业系统ID")
    @TableField(value = "PID")
    @Column(name = "PID", columnDefinition = "BIGINT(19) NOT NULL COMMENT '企业系统ID'")
    private Long pid;
    @Schema(description = "被投资企业")
    @TableField(value = "ENT_NAME")
    @Column(name = "ENT_NAME", columnDefinition = "VARCHAR(128) NOT NULL COMMENT '被投资企业'")
    private String entName;
    @Schema(description = "被投资企业法定代表人/负责人ID")
    @TableField(value = "PERSON_ID")
    @Column(name = "PERSON_ID", columnDefinition = "VARCHAR(32) COMMENT '被投资企业法定代表人/负责人ID'")
    private String personId;
    @Schema(description = "被投资企业法定代表人/负责人")
    @TableField(value = "LEGAL_PERSON")
    @Column(name = "LEGAL_PERSON", columnDefinition = "VARCHAR(128) COMMENT '被投资企业法定代表人/负责人'")
    private String legalPerson;
    @Schema(description = "成立日期")
    @TableField(value = "START_TIME")
    @Column(name = "START_DATE", columnDefinition = "DATETIME COMMENT '成立日期'")
    private Date startDate;
    @Schema(description = "投资占比")
    @TableField(value = "REG_RATE")
    @Column(name = "REG_RATE", columnDefinition = "VARCHAR(16) COMMENT '投资占比'")
    private String regRate;
    @Schema(description = "认缴金额")
    @TableField(value = "REG_CAPITAL")
    @Column(name = "REG_CAPITAL", columnDefinition = "VARCHAR(32) COMMENT '认缴金额'")
    private String regCapital;
    @Schema(description = "状态")
    @TableField(value = "OPEN_STATUS")
    @Column(name = "OPEN_STATUS", columnDefinition = "VARCHAR(16) COMMENT '状态'")
    private String openStatus;

    @Schema(description = "基本信息")
    @TableField(exist = false)
    @ManyToOne(targetEntity = AiqichaHeaderPo.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinColumn(name = "PID", referencedColumnName = "PID", insertable = false, updatable = false)
    private AiqichaHeaderPo aiqichaHeaderPo;
}
